// bzoj1444
// 题意：
//
// 题解：
//
// ml:run = $bin < input
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>

int const maxn = 12;
double const eps = 1e-8;
double prob[26];
double a[1000][1000];
int strid[maxn];
int n, l, m;

template <class T>
T abs(T x) { return x < 0 ? -x : x; }

std::string s[maxn];

namespace ac
{
    int const alpha_size = 26;
    int const max_size = 10000;
    int const dq_size = 10000;

    int next[max_size][alpha_size];
    int fail[max_size];
    int word_tail_count[max_size];

    int dq[dq_size];
    int head, tail;
    int alpha;

    int dq_next(int x) { return (x + 1) % dq_size; }
    int dq_prev(int x) { return (x + dq_size - 1) % dq_size; }
    void clear() { head = tail = 0; }
    bool empty(){ return head == tail; }
    void push_back(int x) { dq[tail] = x; tail = dq_next(tail); }
    void pop_front() { head = dq_next(head); }
    int front() { return dq[head]; }
    void init(int a) { alpha = a; }

    struct trie
    {
        trie() { reset(); }

        void reset() { current_free = 0; root = alloc(); }
        int get_root() { return root; }
        int get_trie_size() { return current_free; }

        void insert(std::string const& s, int id)
        {
            int now = root;
            int len = s.size();
            for (int i = 0; i < len; now = next[now][s[i++] - 'A'])
                if (next[now][s[i] - 'A'] == -1)
                    next[now][s[i] - 'A'] = alloc();
            word_tail_count[now]++;
            strid[id] = now;
        }

        void make_ac_automaton()
        {
            clear();
            fail[root] = root;
            for (int ch = 0; ch < alpha; ch++)
                if (next[root][ch] == -1)
                    next[root][ch] = root;
                else {
                    fail[next[root][ch]] = root;
                    push_back(next[root][ch]);
                }

            while (!empty()) {
                int now = front(); pop_front();
                for (int ch = 0; ch < alpha; ch++)
                    if (next[now][ch] == -1)
                        next[now][ch] = next[fail[now]][ch];
                    else {
                        fail[next[now][ch]] = next[fail[now]][ch];
                        push_back(next[now][ch]);
                    }
            }
        }

    private:

        int alloc()
        {
            for (int i = 0; i < alpha; i++)
                next[current_free][i] = -1;
            word_tail_count[current_free] = 0;
            return current_free++;
        }

        int current_free;
        int root;
    };
}

ac::trie aca;

void init_maxtrix(int n)
{
    for (int i = 0; i < n; i++) a[i][i] = -1;
    a[0][n] = -1;
    for (int i = 0; i < n; i++) {
        if (ac::word_tail_count[i]) continue;
        for (int j = 0; j < m; j++) {
            int now = i;
            while (ac::next[now][j] == -1) now = ac::fail[now];
            now = ac::next[now][j];
            a[now][i] += prob[j];
        }
    }
}

bool gauss(int n)
{
    for (int i = 0; i < n; i++) {
        int id = i;
        for (int j = i + 1; j < n; j++)
            if (abs(a[j][i]) > abs(a[id][i])) id = j;
        if (abs(a[id][i]) <= eps) return false;
        if (id != i)
            for (int j = i; j <= n; j++)
                std::swap(a[i][j], a[id][j]);

        for (int j = 0; j < n; j++)
            if (i != j) {
                double tmp = a[j][i] / a[i][i];
                for (int k = n; k >= i; k--)
                    a[j][k] -= a[i][k] * tmp;
            }
    }

    for (int i = n - 1; i >= 0; i--) {
        for (int j = i + 1; j < n; j++)
            a[i][n] -= a[j][n] * a[i][j];
        a[i][n] /= a[i][i];
    }
    return true;
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin >> n >> l >> m;
    ac::init(m);
    aca.reset();
    for (int i = 0; i < m; i++) {
        int p, q; std::cin >> p >> q;
        prob[i] = (double)p / q;
    }
    for (int i = 0; i < n; i++) {
        std::cin >> s[i];
        aca.insert(s[i], i);
    }
    aca.make_ac_automaton();
    int size = aca.get_trie_size();
    init_maxtrix(size);
    gauss(size);
    for (int i = 0; i < n; i++) {
        double x = a[strid[i]][size];
        if (abs(x) <= eps) x = 0;
        std::cout << std::fixed << std::setprecision(2) << x << "\n";
    }
}

